<template>
  <div>
    <!-- 头部 -->
    <van-nav-bar title="我的订单" left-arrow @click-left="$router.go(-1)" />

    <!-- 搜索框 -->
    <form action="/">
      <van-search
        v-model="searchValue"
        show-action
        placeholder="商品名称/商品编号/订单号"
        @search="onSearch"
        @cancel="onCancel"
      />
    </form>

    <!-- tab标签栏 -->
    <div class="tabCheck">
      <van-tabs v-model="active">
        <van-tab title="全部">
          <all></all>
        </van-tab>
        <van-tab title="待付款">
          <exPay></exPay>
        </van-tab>
        <van-tab title="待收货">
          <exReceiving></exReceiving>
        </van-tab>
        <van-tab title="已完成">
          <done></done>
        </van-tab>
      </van-tabs>

      <!-- 下拉选项菜单 -->
      <van-dropdown-menu active-color="#1989fa">
        <van-dropdown-item ref="item">
          <template #title>
            <van-icon name="arrow-down" />
          </template>
          <template>
            <van-grid :column-num="3" :border="false">
              <van-grid-item v-for="(value,i) in list" :key="i">
                <template #default>
                  <van-button round v-for="(item, index) in value" :key="index" :text="item"></van-button>
                </template>
              </van-grid-item>
            </van-grid>
          </template>
        </van-dropdown-item>
      </van-dropdown-menu>
    </div>
    <common-footer></common-footer>
  </div>
</template>

<script>
import exPay from './exPay.vue'
import all from './All.vue'
import exReceiving from './exReceiving.vue'
import done from './Done.vue'
export default {
  props: ['id'],
  data () {
    return {
      searchValue: '',
      active: 1,
      list: [
        ['话费充值', '游戏充值', '我的机票', '本地生活服务', '度假'],
        ['流量充值', '我的电影票', '我的酒店', '全新整车', '常够清单'],
        ['加油卡充值', '我的火车票', '医药服务', '彩票订单', '回收站']
      ]
    }
  },
  watch: {
    active () {
      return this.id
    }
  },
  components: {
    all,
    exPay,
    exReceiving,
    done
  },
  mounted () {},
  methods: {
    onSearch (val) {},
    onCancel () {}
  }
}
</script>

<style lang="less" scoped>
.van-tabs__wrap::after {
  display: inline-block;
  content: "\F007";
}
.tabCheck {
  display: flex;
  position: relative;
}
.van-tabs {
  flex: 5;
}
.van-dropdown-menu {
  position: absolute;
  right: 0;
  flex: 1;
  height: 44px;
}

/deep/.van-dropdown-menu > .van-dropdown-menu__bar {
  box-shadow: none;
  height: 44px;
  .van-dropdown-menu__title::after {
    content: none;
  }
}

.van-button {
  width: 100px;
  height: 34px;
  padding: 0;
  line-height: 34px;
  background-color: transparent;
  margin-bottom: 12px;
}
/deep/.van-grid-item__content {
  padding: 16px 0;
}
/deep/.van-tabs__content {
  height: 100%;
  background-color: #fafafa;
}
</style>
